﻿CREATE TABLE [dbo].[Parteneri] (
    [IDPartener]                 BIGINT          IDENTITY (1, 1) NOT NULL,
    [CUI]                        DECIMAL (13)    NOT NULL,
    [Denumire]                   VARCHAR (200)   NOT NULL,
    [IDBanca]                    SMALLINT        CONSTRAINT [DF_Parteneri_IDBanca] DEFAULT ((0)) NOT NULL,
    [ContBancar]                 VARCHAR (50)    NOT NULL,
    [Cont]                       VARCHAR (50)    NOT NULL,
    [CodUnitate]                 SMALLINT        CONSTRAINT [DF_Furnizori_CodUnitate] DEFAULT ((0)) NOT NULL,
    [TipPartener]                VARCHAR (50)    CONSTRAINT [DF_Parteneri_TipPartener] DEFAULT ('FC') NOT NULL,
    [IDJudet]                    INT             CONSTRAINT [DF_Parteneri_IDJudet] DEFAULT ((0)) NOT NULL,
    [IDLocalitate]               INT             CONSTRAINT [DF_Parteneri_IDLocalitate] DEFAULT ((0)) NOT NULL,
    [Strada]                     VARCHAR (50)    NULL,
    [Nr]                         VARCHAR (10)    NULL,
    [AtributFiscal]              VARCHAR (10)    CONSTRAINT [DF_Parteneri_AtributFiscal] DEFAULT ('RO') NOT NULL,
    [JudetRegComert]             SMALLINT        CONSTRAINT [DF_Parteneri_JudetRegComert] DEFAULT ((0)) NOT NULL,
    [NrRegComert]                INT             CONSTRAINT [DF_Parteneri_NrRegComert] DEFAULT ((0)) NOT NULL,
    [AnRegComert]                SMALLINT        CONSTRAINT [DF_Parteneri_AnRegComert] DEFAULT ((0)) NOT NULL,
    [NumeDelegat]                VARCHAR (50)    CONSTRAINT [DF_Parteneri_NumeDelegat] DEFAULT ('') NOT NULL,
    [SerieAI]                    VARCHAR (5)     CONSTRAINT [DF_Parteneri_SerieAI] DEFAULT ('') NOT NULL,
    [NrAI]                       VARCHAR (6)     CONSTRAINT [DF_Parteneri_NrAI] DEFAULT ('') NOT NULL,
    [MijlocTransport]            VARCHAR (50)    CONSTRAINT [DF_Parteneri_MijlocTransport] DEFAULT ('') NOT NULL,
    [NrMijlocTransport]          VARCHAR (50)    CONSTRAINT [DF_Parteneri_NrMijlocTransport] DEFAULT ('') NOT NULL,
    [CodPostal]                  VARCHAR (10)    NULL,
    [Telefon]                    VARCHAR (50)    NULL,
    [Fax]                        VARCHAR (50)    NULL,
    [ContClient]                 [dbo].[TipCont] NULL,
    [IDContactDelegat]           INT             NULL,
    [IDMijlocTransport]          SMALLINT        NULL,
    [ConditiiDePlata]            VARCHAR (250)   NULL,
    [IDTara]                     INT             NULL,
    [ScadentaFacturiClient]      INT             NULL,
    [ScadentaFacturiFurnizor]    INT             NULL,
    [ScadentaFacturiSfarsitLuna] BIT             DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_Furnizori] PRIMARY KEY CLUSTERED ([IDPartener] ASC),
    CONSTRAINT [FK_Parteneri_Contact] FOREIGN KEY ([IDContactDelegat]) REFERENCES [dbo].[Contact] ([IDContact]),
    CONSTRAINT [FK_Parteneri_MijloaceTransport] FOREIGN KEY ([IDMijlocTransport]) REFERENCES [dbo].[MijloaceTransport] ([IDMijlocTransport])
);


GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_Parteneri]
    ON [dbo].[Parteneri]([CUI] ASC, [CodUnitate] ASC);

